// 全局变量
function checkName() {
  console.log('hi js');
}
function checkEmail() { }
function checkPassword() { }

// 同名变量覆盖之前的函数
function checkName() {
  console.log('hi,bobo');
}

checkName()


// this指向当前对象
let CheckObj = {
  checkName: function () {
    console.log('0')
    return this
  },
  checkEmail: function () {
    console.log('1')
    return this
  },
  checkPassword: function () {
    console.log('2')
    return this
  },
}
/** 
 var CheckObj = {
   checkName: function () {
     console.log('1');
   }
 }
*/

// 函数的链式调用
CheckObj.checkName().checkEmail()


// 声明类对象
let CheckObject = function () { }
CheckObject.prototype = {
  checkName: function () {
    console.log('01')
    return this
  },
  checkEmail: function () {
    console.log('02')
    return this
  },
  checkPassword: function () {
    console.log('03')
    return this
  }
}

let obj = new CheckObject()
obj.checkName().checkEmail()